﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;

namespace SceneManager.Processors
{
    /// <summary>
    /// Represents a RenderGraph used to render cel-shading effects
    /// </summary>
    public class CelShadingRenderGraph : RenderGraph
    {
        /// <summary>
        /// Initializes a new instance of the CelShadingRenderGraph with the specified objects and lights to render
        /// </summary>
        /// <param name="game">The game associated with this RenderGraph</param>
        /// <param name="objects">The list of objects to render in the scene</param>
        /// <param name="lights">The list of lights in the scene</param>
        public CelShadingRenderGraph(Game game, List<DrawableObject> objects, List<Light> lights)
        {
            Add("NormalDepthColor", new NormalDepthColorProcessor(game, objects));
            Add("Light", new LightProcessor(game, lights, Color.White));
            Add("EdgeDetection", new EffectProcessor(game, "Shaders/Cel-shading/EdgeDetection"));
            Add("Shading", new EffectProcessor(game, "Shaders/Cel-shading/Shading"));
            Add("Screen", new ScreenProcessor(game));

            // Light
            Link("NormalDepthColor", "Normal", "Light", "Normal");
            Link("NormalDepthColor", "Depth", "Light", "Depth");
            Link("NormalDepthColor", "Color", "Light", "Color");

            // EdgeDetection
            Link("NormalDepthColor", "Depth", "EdgeDetection", "Depth");

            // Shading
            Link("NormalDepthColor", "Color", "Shading", "Color");
            Link("EdgeDetection", "Output", "Shading", "Edge");
            Link("Light", "Light", "Shading", "Light");

            // Screen
            Link("Shading", "Output", "Screen", "Input1");
        }
    }
}
